package br.ujr.util;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.SequenceFile;
import org.apache.hadoop.io.Text;

public class ReadIntermediateMapReduceFiles {
	
	public static void main(String[] args) throws Exception {
		
		  Path pathToFile = new Path("/private/tmp/hadoop-ualter/mapred/local/taskTracker/ualter/jobcache/job_201202081933_0005/attempt_201202081933_0005_m_000000_0/output/file.out");
		
		  Configuration conf = new Configuration();
		  FileSystem fs = FileSystem.get(conf);

		  SequenceFile.Reader reader = new SequenceFile.Reader(fs, pathToFile, conf);

		  Text key = new Text(); // this could be the wrong type
		  Text val = new Text(); // also could be wrong

		  while (reader.next(key, val)) {
		    System.out.println(key + ":" + val);
		  }
		
	}

}
